package com.crm.controller;


import com.crm.base.PageResult;
import com.crm.domain.dto.QueryLogs;
import com.crm.domain.entity.Logs;
import com.crm.domain.vo.LogsVo;
import com.crm.service.LogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags = "日志管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/monitor/operlog")
public class LogController {
    private final LogService logService;

    /**
     * 查询操作日志列表
     * @param queryLogs
     * @return
     */
    @ApiOperation(value = "查询操作日志列表")
    @GetMapping("/list")
    public PageResult<List<Logs>> queryLogList(QueryLogs queryLogs){
        PageResult<LogsVo> pageResult = logService.queryLogList(queryLogs);
        return PageResult.success(pageResult.getMsg(), pageResult.getRows(), pageResult.getTotal());
    }
}
